<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>我的订单-订单列表</title>
<link rel="stylesheet" href="__PUBLIC__/Mobile/css/zhanghou.css">
<script src="__PUBLIC__/Mobile/js/jquery-1.9.1.js"></script>
<script src="__PUBLIC__/Common/Layer/layer.js"></script>
</head>

<body >
<section>
<!--我的订单-->
<div class="lm" style="position:fixed;">
  <a href="javascript:history.back(-1);">
    <img src="__PUBLIC__/Mobile/images/return.png" style="height:22px; padding-left:3%; line-height:22px; width:6%; padding-top:2%;" class="left">
  </a>
    <span class="left size20" style="width:85%;">我的订单 </span>
</div>
<div class="Order-form s" style="position:fixed; margin-top: 49px; width:100%;">
  <a href="{:U('Order/order_list')}">全部</a>
  <a href="{:U('Order/payment_list')}">待付款</a>
  <a href="{:U('Order/receipt_goods')}" class="hover">待收货</a>
  <a href="{:U('Order/payments_waite')}">待评价</a>
  <a href="{:U('Order/order_end')}">待完成</a>
<!--   <a href="#">退货/换货</a> -->
</div>

<div class="shopping-cart" style="padding-top:120px;">
<script>
  $(function(){
    
      $('.margin-top').each(function(){
          var  goods_num = 0;
          $(this).find('.goods_num').each(function(){
            goods_num += parseInt($(this).val());
          });
          $(this).find('.jian_nub').html(goods_num);
      })
  })
</script>

<foreach name="res" item="vo">
        <ul class="margin-top">
          <h3 class="s"><span class="l">订单号:{$vo.orders_num}</span><span style="float:right;">




                                    <if condition="$vo['pay_status'] eq 0">
                                        待付款
                                    </if>


                                    <if condition="$vo['pay_status'] eq 1 && $vo['orders_status'] eq 0">
                                        待发货
                                    </if>

                                    <if condition="$vo['orders_status'] egt 2">
                                        <if condition="!empty($vo['fahuo_time'])">
                                        已发货
                                        </if>
                                    </if>

                                    <if condition="$vo['orders_status'] eq 3">
                                        已签收
                                    </if>

                                    <if condition="$vo['orders_status'] eq 4">
                                        已申请退货
                                    </if>

                                    <if condition="$vo['orders_status'] eq 6">
                                        拒绝退货申请
                                    </if>

                                    <if condition="$vo['orders_status'] eq 7">
                                        允许退货并退款
                                    </if>

                                    <if condition="$vo['orders_status'] eq 8">
                                        已完成
                                    </if>

                                    



 
          </span></h3>
          <foreach name="vo.result" item="rvo">
            <li>
            <a href="javascript:;">
            <b><img style="width:60px; height:60px; margin:5px;" src="__PUBLIC__/Uploads/goods/{$rvo.pic_url}"></b>
            <strong style="width:62%;">
            <p>{$rvo.goods_title}</p>
            </strong>
            <span><p>￥{$rvo.price_new}</p>
            <!-- <del class="gray">{$rvo.price_old}</del> -->
            <p class="gray">x{$rvo.goods_num}</p>
            <input type="hidden" class="goods_num" value="{$rvo.goods_num}">
            </span>
            </a>
            </li>
            </foreach>
          <p class="Subtotal"><span class="gray">小计(共<span class="jian_nub">1</span>件)：</span><span class="Orange size20">￥{$vo.price_sum}</span></span></p>
          <p class="confirm" style="border-bottom:1px solid #ccc; margin-bottom:10px;">
            <span style="margin-left:20px;">下单时间:{$vo.create_time|date="Y-m-d H:i:s",###}</span>
          </p>
          <p class="confirm">



          <if condition="$vo.orders_status eq 0 && $vo.pay_status eq 0">
              <a href="{:U('Goods/make_pay_button')}?orders_num={$vo.orders_num}" class="hover">立即付款</a>
              <a href="javascript:;" onclick="del({$vo.id})">取消订单</a>
          </if>


          <if condition="!empty($vo['fahuo_time'])">
              <a href="javascript:;" onclick="show_info('{$vo.kuaidi_name}',{$vo.kuaidi_num})">查看物流</a>
          </if>


          <if condition="$vo['pay_status'] neq 0 && $vo['orders_status'] neq 3">
            <a href="{:U('User/tuihuo')}?orders_id={$vo.id}" class="payment">退货</a>
        </if>

      <if condition="$vo['orders_status'] eq 2">                                   
            <a href="{:U('User/queren_shouhuo')}?orders_id={$vo.id}" style="background:#4ECF5B;color:#FFF;" class="payment">确认收货</a>
        </if>

        <if condition="$vo['orders_status'] eq 3">                                           
            <a href="{:U('User/pingjia')}?orders_id={$vo.id}" class="payment">评价</a>
        </if>



       </p>
    </ul>
</foreach>



<include file="Public:footer_orders" />



<script>
  function del(a){
    $.ajax({
      data:"id="+a,
      type:"POST",
      url:"{:U('Order/cancel_order')}",
      success:function(msg){
       if(msg == 1){
          parent.layer.msg('操作成功',{icon:1,time:1000},function(){
            window.location.reload();
          });
       }else{
          parent.layer.msg('操作失败',{icon:2,time:2000})
       }

      }
    });
  }
</script>
<script>
  function show_info(a,b){
    parent.layer.open({
      type: 2,
      shadeClose: true,
      shade: 0.2,
      area: ['325px', '480px'],
      title: '查询快递单号',
      content: '__ROOT__/kuaidi/get.php?com='+a+'&nu='+b,
    });
  }             
</script>
</div>
</section>
</body>
</html>
